﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace SafeLoad.NControl
{
  /// <summary>
  /// NDraft.xaml 的交互逻辑
  /// </summary>
  public partial class NDraft : UserControl
  {
    public NDraft()
    {
      InitializeComponent();
    }

    public static readonly DependencyProperty Draft_TAProperty = DependencyProperty.Register("Draft_TA",
      typeof(double), typeof(NDraft), new PropertyMetadata(0.000));
    /// <summary>
    /// 后面
    /// </summary>
    public double Draft_TA
        {
      get { return (double)GetValue(Draft_TAProperty); }
      set { SetValue(Draft_TAProperty, value); }
    }

    public static readonly DependencyProperty LeftDraftProperty = DependencyProperty.Register("Draft_TM_PS",
      typeof(double), typeof(NDraft), new PropertyMetadata(0.0));
    /// <summary>
    /// 左面
    /// </summary>
    public double Draft_TM_PS
        {
      get { return (double)GetValue(LeftDraftProperty); }
      set { SetValue(LeftDraftProperty, value); }
    }

    public static readonly DependencyProperty FrontDraftProperty = DependencyProperty.Register("Draft_TF",
      typeof(double), typeof(NDraft), new PropertyMetadata(0.0));
    /// <summary>
    /// 前面
    /// </summary>
    public double Draft_TF
        {
      get { return (double)GetValue(FrontDraftProperty); }
      set { SetValue(FrontDraftProperty, value); }
    }

    public static readonly DependencyProperty RightDraftProperty = DependencyProperty.Register("Draft_TM_SB",
      typeof(double), typeof(NDraft), new PropertyMetadata(0.0));
    /// <summary>
    /// 右面
    /// </summary>
    public double Draft_TM_SB
        {
      get { return (double)GetValue(RightDraftProperty); }
      set { SetValue(RightDraftProperty, value); }
    }

		public void SetVolBkColor(List<System.Drawing.Color> bkcolors, List<string> tanknames)
		{
			int pos = tanknames.IndexOf("RCAR1P");
			System.Drawing.Color bkcolor = bkcolors[pos];
			this.Draft_RCAR1P.Background = new SolidColorBrush(Color.FromRgb(bkcolor.R, bkcolor.G, bkcolor.B));

			pos = tanknames.IndexOf("RCAR1S");
			bkcolor = bkcolors[pos];
			this.Draft_RCAR1S.Background = new SolidColorBrush(Color.FromRgb(bkcolor.R, bkcolor.G, bkcolor.B));

			pos = tanknames.IndexOf("RCAR2P");
			bkcolor = bkcolors[pos];
			this.Draft_RCAR2P.Background = new SolidColorBrush(Color.FromRgb(bkcolor.R, bkcolor.G, bkcolor.B));

			pos = tanknames.IndexOf("RCAR2S");
			bkcolor = bkcolors[pos];
			this.Draft_RCAR2S.Background = new SolidColorBrush(Color.FromRgb(bkcolor.R, bkcolor.G, bkcolor.B));

			pos = tanknames.IndexOf("RCAR3P");
			bkcolor = bkcolors[pos];
			this.Draft_RCAR3P.Background = new SolidColorBrush(Color.FromRgb(bkcolor.R, bkcolor.G, bkcolor.B));

			pos = tanknames.IndexOf("RCAR3S");
			bkcolor = bkcolors[pos];
			this.Draft_RCAR3S.Background = new SolidColorBrush(Color.FromRgb(bkcolor.R, bkcolor.G, bkcolor.B));

			pos = tanknames.IndexOf("RCAR4P");
			bkcolor = bkcolors[pos];
			this.Draft_RCAR4P.Background = new SolidColorBrush(Color.FromRgb(bkcolor.R, bkcolor.G, bkcolor.B));

			pos = tanknames.IndexOf("RCAR4S");
			bkcolor = bkcolors[pos];
			this.Draft_RCAR4S.Background = new SolidColorBrush(Color.FromRgb(bkcolor.R, bkcolor.G, bkcolor.B));

			pos = tanknames.IndexOf("RCAR5P");
			bkcolor = bkcolors[pos];
			this.Draft_RCAR5P.Background = new SolidColorBrush(Color.FromRgb(bkcolor.R, bkcolor.G, bkcolor.B));

			pos = tanknames.IndexOf("RCAR5S");
			bkcolor = bkcolors[pos];
			this.Draft_RCAR5S.Background = new SolidColorBrush(Color.FromRgb(bkcolor.R, bkcolor.G, bkcolor.B));

			pos = tanknames.IndexOf("RSLOPP");
			bkcolor = bkcolors[pos];
			this.Draft_RSLOPP.Background = new SolidColorBrush(Color.FromRgb(bkcolor.R, bkcolor.G, bkcolor.B));

			pos = tanknames.IndexOf("RSLOPS");
			bkcolor = bkcolors[pos];
			this.Draft_RSLOPS.Background = new SolidColorBrush(Color.FromRgb(bkcolor.R, bkcolor.G, bkcolor.B));
		}
	}
}
